﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#if DOT_NET
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
#endif
using StyleMVVM.UnitTests.TestClasses.SimpleObjects;
using StyleMVVM.Data.Activation;
using StyleMVVM.DependencyInjection;
using StyleMVVM.UnitTests.TestClasses.MultipleImport;

namespace StyleMVVM.UnitTests.DependencyInjection
{
	[TestClass]
	public class LazyImportTests : BaseTestClass
	{
		[TestMethod]
		public void ImportTest()
		{
			LazyImportClass importClass = (LazyImportClass)Container.Locate("LazyImportClass");

			Assert.IsNotNull(importClass);

			var exports = importClass.Exports;

			Assert.IsNotNull(importClass.GenericImport);
			Assert.IsFalse(importClass.GenericImport.IsValueCreated);

			var genericValue = importClass.GenericImport.Value;

			Assert.IsNotNull(genericValue);

			Assert.IsNotNull(importClass.Export);
			Assert.IsNotNull(exports);
			Assert.IsTrue(exports.Any());
		}
	}
}